import {DispatcherUtils} from "../util/DispatcherUtils"
import {Event} from "../Event"
export class HeroData{
    private static _uid: number=0;              // uid
    private static _nickname: string = "";        // 昵称
    private static _gold: number = 0;         // 金币
    private static _gameInfo: { "all": number, "win": number }=null;  // 游戏总局数，胜利局数
    private static _tableId: number = 0;       // 房间id

    static clear(){
        this._uid = 0;
    }

    static get uid(): number {
        return this._uid;
    }

    static set uid(value: number) {
        this._uid = value;
    }

    static get nickname(): string {
        return this._nickname;
    }

    static set nickname(value: string) {
        this._nickname = value;
        DispatcherUtils.dispatchEvent(Event.HERO_NAME_UPDATE)
    }

    static get gold(): number {
        return this._gold;
    }

    static set gold(value: number) {
        this._gold = value;
        DispatcherUtils.dispatchEvent(Event.HERO_GOLD_UPDATE)
    }

    static get gameInfo(): { all: number; win: number } {
        return this._gameInfo;
    }

    static set gameInfo(value: { all: number; win: number }) {
        this._gameInfo = value;
    }

    static get tableId(): number {
        return this._tableId;
    }

    static set tableId(value: number) {
        this._tableId = value;
        DispatcherUtils.dispatchEvent(Event.HERO_TABLEID_UPDATE)
    }

}